<?php
/**
 * GEO position with description
 * @author Oskar Kvamme
 */
class Location extends Model {
    var $latitude = 0.0;
    var $longitude = 0.0;
    var $description = "";

    function Location()
    {
        parent::Model();
        $this->load->database();
    }

    //add position/waypoint to database
    function addPosition($lat, $long, $desc)
    {
        $this->latitude = $lat;
        $this->longitude = $long;
        $this->description = $desc;

        $this->db->insert('locations', $this);
    }

    //returns all positions/waypoints from database
    function getPositions()
    {
        $query = $this->db->get("locations");
	return $query->result();
    }
}
?>
